Copyright: Copyright © LVDI Software


Contents
  DBExport ActiveX V 1.5

       Properties	 Methods        Events	       Technical support

Description

The component DBExport enables you to export any Database or table in a professional way.
You can define formats using a wizard, choosing the type of file you want (variable, fixed, access, paradox...) the separator character, the fields you want, the ordering of the fields, and many other setttings.

The two mandatory properties are the DataBaseName  (the table you want to export) and the IniFile (the file that will hold the user settings).

After initializing this two properties (either using the properties window or directly in your code), you can call either the method execute
to allow the user export the tables interactively; or call the method BatchExport to do batch exporting.

Use the property ExportCaption if you want to change the default caption, the property ExportFile enables you to initialize the name of the resulting file, if you provide a help file set the HelpId to point to the help topic.


Properties

ConnectString

DataBaseName

ExportCaption
IniFile
ExportFile
HelpId

MultiTable

OverWrite

Password
QuitAfterExport

ShowProgress
ShowSummary

TableName


Technical Support

For latest information and bug reporting, you can contact us directly through these :

Internet         : support@lvdisoft.com

Web site       : http://www.lvdisoft.com

Fax	        : +33 1 46 63 42 31

Address       : LVDI Software 67, rue Charles Frerot 94250 Paris-Gentilly France


DataSet
DataBaseName Property

Applies to

DBExport component

Syntax

object.DataBaseName [= string]

The DataBaseName property syntax has these parts:

Part	Description

string	A string expression that evaluates to the name of the Database that you want to export.

Description

Set this property to the name of the database that contains the data that will be exported.

Example

  DBExportDialog1.DataBaseName = "c:\test\MyTable.mdb"

  DBExportDialog1.ConnectString = Access

  DBExportDialog1.IniFile = "eSettings.ini"

  DBExportDialog1.execute


ExportCaption
ExportCaption Property

Applies to

DBExport component

Syntax

object.Caption [= string]

The Caption property syntax has these parts:

Part	Description

string	A string expression that evaluates to the text displayed as the caption.

Default

"Export Data"

Description

Set this property to display a caption (window title) that suites your needs.

Example

  DBExportDialog1.ExportCaption = "Export customer data"


IniFile
IniFile Property

Applies to

DBExport component

Syntax

object.IniFile [= string]

The IniFile property syntax has these parts:

Part	Description

string	A string expression that evaluates to the name of a parameter file that will hold user settings.

Description

Set this property to the name of the IniFile that will contain the settings that the user will save.

Don't forget that you prepare a setting for a known table, this setting will contain field names, if you try to apply that setting to another table (that have different field names) you will get an error message :'This setting is incompatible with the current table'.

You can have one inifile storing settings for different tables if you give a significant  name for each setting, like 'CustomerSetting' for example.

Example

  DBExportDialog1.DataBaseName = "c:\test\MyTable.mdb"

  DBExportDialog1.IniFile = "eSettings.ini"

  DBExportDialog1.execute


ExportFile
ExportFile Property

Applies to

DBExport component

Syntax

object.ExportFile [= string]

The ExportFile property syntax has these parts:

Part	Description

string	A string expression that evaluates to the default output file name.

Default

""

Description

Set this property to initialize the edit box file name. If you don't set this property the edit box will be empty (if it's the first export ) or will hold the last used filename.

Example

  DBExportDialog1.ExportFile = "c:\tmp|export.txt"


HelpId
HelpId Property

Applies to

DBExport component

Syntax

object.HelpId [= integer]

The HelpId property syntax has these parts:

Part	Description

integer	A numeric expression specifying the Help Id to use.

Default

0

Description

If you provide a help file you must set this property to point to your help file topic.number.

Leave it to zero if you don't provide a help file.

Example

  DBExportDialog1.HelpId = 133


MutliTable
MutliTable Property

Applies to

DBExport component

Syntax

object.MultiTable [= boolean]

The MultiTable property syntax has these parts:

Part	  Description

boolean	  A Boolean expression that specifies whether the DBExport dialog will be allow the user to choose the table to export.

Default

False

Description

This property enables you to show or hide the first page of the DBExport wizard, which displays the list of tables of the current database, allowing the user to choose which table to export.

If you set this property to false, then the property TableName must not be empty.

Example

  DBExportDialog1.MultiTable = True


Password
Password Property

Applies to

DBExport component

Syntax

object.Password [= string]

The password property syntax has these parts:

Part	Description

string	A string expression that password of the Database or Table that you want to export.

Description

Set this property to the password of the database that contains the data that will be exported, to avoid the DBExport component to display a dialog inviting the user to type in his password  (especially if the user already entered his password to access the application).

Example

  DBExportDialog1.DataBaseName = "c:\test\MyTable.mdb"

  DBExportDialog1.Password = "secret"

  DBExportDialog1.IniFile = "eSettings.ini"

  DBExportDialog1.execute


Events

BeforeFieldExport

BeforeRecordExport

FilterField

FilterTable

FilterType


FilterField
FilterField Event

Applies to

DBExport component

Syntax

Private Sub DBExportDialog1_FilterField(ByVal TableName As String, ByVal FieldName As String, Hide As Boolean)

The FilterField event syntax has these parts:

Part	Description

TableName	A string that correspond to the table name being exported.

FieldName	The field that is currently exported

Hide	A boolean that indicates if that field will be available for export to the user .

Description

This event happens before a field is proposed to the user for export.

If set to hide, the user will not see that field (as if it were not a column of the table)

Example

Private Sub DBExport1_FilterField(ByVal TableName As String, ByVal FieldName As String, Hide As Boolean)

    If TableName = "Employees" And FieldName = "Salary" Then Hide = True

End Sub


QuitAfterExport

QuitAfterExport Property

Applies to

DBExport component

Syntax

object.Enabled [= boolean]

The Enabled property syntax has these parts:

Part	  Description

boolean	  A Boolean expression that specifies whether the DBExport dialog is closed after the export is finished.

Default

False

Description

This property enables you to decide weather the wizard dialog will close itself after finishing the export.

By default it is set to 'False', i.e the dialog will stay until the user clicks on the button cancel.

Example

  DBExportDialog1.QuitAfterExport = True


TableName
TableName Property

Applies to

DBExport component

Syntax

object.TableName [= string]

The TableName property syntax has these parts:

Part	Description

string	A string expression that evaluates to the name of the table that you want to export.

Description

Set this property to the name of the table that you to export.

Example

  DBExportDialog1.DataBaseName = "c:\test\MyTable.mdb"

  DBExportDialog1.TableName = "Customers"

  DBExportDialog1.ConnectString = Access

  DBExportDialog1.IniFile = "eSettings.ini"

  DBExportDialog1.execute


Connect Property
ConnectString Property

Applies to

DBExport component

Syntax

object.ConnectString [= TypeConnect]

The ConnectString property syntax has these parts:

Part	Description

TypeConnect	A connect type that indicates what is the source database (that you want to export), it can be any one of : Access,  Paradox3, Paradox4, Paradox5, DBase3, DBase4,  DBase5,  Foxpro20, Foxpro25, Foxpro26, Foxpro30

Default

Access

Description

Set this property to the type of the database that contains the data that will be exported.

Example

  DBExportDialog1.DataBaseName = "c:\test\MyTable.mdb"

  DBExportDialog1.ConnectString = Access

  DBExportDialog1.IniFile = "eSettings.ini"

  DBExportDialog1.execute


OverWrite
OverWrite Property

Applies to

DBExport component

Syntax

object.OverWrite [= boolean]

The OverWrite property syntax has these parts:

Part	  Description

boolean	  A Boolean expression that specifies whether the exported file will be overwritten if it already exists.

Default

True

Description

Setting this property to false will force the DBExport component to display a message box asking the user if he wants to overwrite the existing output file.

In the case where the output file does not already exist, this property has no effect.

When doing batch export, it is better to set this property to true to avoid the blocking of the batch process.

Example

  DBExportDialog1.OverWrite = True


Execute

Execute Method

Applies to

DBExport component

Syntax

object.Execute

Description

This method displays the export dialog box and returns when the user clicks on the cancel button.

Example

  DBExportDialog1.DataBaseName = "c:\test\MyTable.mdb"

  DBExportDialog1.ConnectString = Access

  DBExportDialog1.IniFile = "eSettings.ini"

  DBExportDialog1.execute


ShowSummary

ShowSummary Property

Applies to

DBExport component

Syntax

object.ShowProgress [= boolean]

The ShowProgress property syntax has these parts:

Part	  Description

boolean	  A Boolean expression that specifies whether a summary dialog will be displayed at the end of the export process.

Default

True

Description

This property enables you to display a dialog box at the end, that displays the number of records exported.

Set it to false when doing batch processing (no user interaction).

Example

  DBExportDialog1.ShowSummary = False


BeforeFieldExport

BeforeFieldExport Event

Applies to

DBExport component

Syntax

Private Sub DBExport1_BeforeFieldExport(ByVal TableName As String, ByVal FieldName As String, ByVal FieldType As Integer,
 ByVal FieldSize As Integer, bufField As String)

The BeforeFieldExport event syntax has these parts:

Part	Description

TableName	A string that correspond to the table name being exported.

FieldName	The field that is currently exported

FieldType	The type of the field that is currently exported (can be any of  : dbBigInt dbBinary dbBoolean	dbByte dbChar dbCurrency dbDate dbDecimal dbDouble dbFloat dbGUID dbInteger dbLong dbMemo dbNumeric dbSingle dbText dbTime dbTimeStamp)

FieldSize            Integer representing the size of the field

bufField	The value that is going to be exported.

Description

This event happens before a value is exported to the text file, it could be useful in many cases for example formatting a number with leading zeros and a sign.

Use the FieldName, FieldType, and FieldSize informations to choose the field you want to change and use the FieldValue to assign a new value.

Example

'In this example we export to a text file and we need to insert a comma in a special field

'Input : 50000 output : 500,00

Private Sub DBExport1_BeforeFieldExport(ByVal TableName As String, ByVal FieldName As
String, ByVal FieldType As Integer, ByVal FieldSize As Integer, bufField As String)

if  FieldName = "Amount"  then

bufField = Left(bufField,Len(FieldValue)-2) + ","+Right ( bufField,2)

end sub


BeforeRecordExport

BeforeRecordExport Event

Applies to

DBExport component

Syntax

Private Sub DBExport1_BeforeRecordExport(bufRecord As String)

The BeforeRecord Export event syntax has these parts:

Part	Description

bufRecord	The record that is going to be exported.

Description

This event happens before the record  is exported to the text file, you can use this event to append a program generated field (not in the database), for example you can generate a key.

Example

'In this example we need to generate a key for each exported record,

'we will assume that it is a variable length record with a comma as a field separator

Private Sub DBExport1_BeforeRecordExport(bufRecord As String)

Key = Key + 1

bufRecord  = bufRecord  + "," + Str(Key)

end sub


BatchExport

BatchExport Method

Applies to

DBExport component

Syntax

object.BatchExport setting

The BatchExport method syntax has these parts:

Part	Description

setting	Required. string expression specifying the name of a setting that was defined in the wizard.

Description

This method allows to do export in batch mode, with no user interaction.

The first and only parameter is the name of a previously designed setting.

Example

  DBExportDialog1.DataBaseName = "c:\temp\nwind.mdb"

  DBExportDialog1.IniFile = "eSettings.ini"

  DBExportDialog1.ShowSummary = False

  DBExportDialog1.OverWrite = True

  DBExportDialog1.ExportFile = "c:\tmp\out.txt" 'do not forget to specify the output file!

  DBExportDialog1.BatchExport("CustomersSetting")


Methods

Execute

BatchExport


ShowProgress

ShowProgress Property

Applies to

DBExport component

Syntax

object.ShowProgress [= boolean]

The ShowProgress property syntax has these parts:

Part	  Description

boolean	  A Boolean expression that specifies whether the progress dialog will be displayed during the export.

Default

True

Description

This property enables you to show or hide the progress bar, this can be useful when doing batch processing (no user interaction), and also to speedup the export process.

Example

  DBExportDialog1.ShowProgress = False


FilterTable
FilterTable Event

Applies to

DBExport component

Syntax

Private Sub DBExport1_FilterTable(ByVal TableName As String, Hide As Boolean)

The FilterTable event syntax has these parts:

Part	Description

TableName	A string that correspond to the table name being exported.

Hide	A boolean that indicates if that table will be available for export to the user .

Description

This event happens before a table is proposed to the user for export.

If set to hide, the user will not see that table (as if it were not part of the DataBase)

This event is significant only in the MultiTable case.

Example

Private Sub DBExport1_FilterTable(ByVal TableName As String, Hide As Boolean)

    If TableName = "Employees" Then Hide = True

End Sub


FiterType
FiterType Event

Applies to

DBExport component

Syntax

Private Sub DBExport1_FilterType(ByVal FileType As Integer, Hide As Boolean)

The FilterType event syntax has these parts:

Part	Description

FilterType	An integer that represents a file type, can be any of : TVariable, TFixed, THtmlTags, TAccess, TParadox3, TParadox4, TParadox5, TDBase3, TDBase4, TDBase5, TFoxpro20, TFoxpro25, TFoxpro26, TFoxpro30

Hide	A boolean that indicates if that filetype will be available for export to the user .

Description

This event happens before a filetype is proposed to the user as a type for the output file. If set to hide, the user will not see that file type..

Example

Private Sub DBExport1_FilterType(ByVal FileType As Integer, Hide As Boolean)

    ' filter out Foxpro 2.0 tables

    If FileType = TFoxpro20 Then Hide = True

End Sub